package org.myrabbitmqdemo.service;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

/**
 * @Date 2025/6/10 11:14
 * @Author guangang
 */
@Service
public class DirectExchangeWithQueueService {
    @RabbitListener(bindings = @QueueBinding(
        value = @Queue("test-queue"),
        exchange = @Exchange("heipi"),
        key = "my.direct.classic"
    ))
    public void myDirectClassic(String message) {
        System.out.println("接收到消息1：" + message);
    }
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue("my.classic"),
//            exchange = @Exchange("my.direct"),
//            key = "my.direct.classic"
//    ))
//    public void myDirectClassic2(String message) {
//        System.out.println("接收到消息2：" + message);
//    }
//
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue("my.quorum"),
//            exchange = @Exchange("my.direct"),
//            key = "my.direct.quorum"
//    ))
//    public void myDirectQuorum(String message) {
//        System.out.println("接收到消息：" + message);
//    }
//
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue("my.stream"),
//            exchange = @Exchange(name = "my.direct",type = "direct"),
//            key = "my.direct.stream"
//    ))
//    public void myDirectStream(String message) {
//        System.out.println("接收到消息：" + message);
//    }

}
